﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Class01
{
    class SumUtils
    {
        //创建一个名为计算工具类 SumUtils，在类中分别定义：
        //计算两个整数相加、
        //两个小数相加、 
        //两个字符串相加、
        //以及从 1 到指定整数的和的方法。
        //在 Main 方法中分别调用定义好的方法。
        //根据题目要求，分别定义 3 个带两个参数的方法，以及一个带一个整型参数的方法，
        //四个方法名相同。

        public int Num1 { get; set; }
        public int Num2 { get; set; }
        public SumUtils(int num1,int num2){
            this.Num1 = num1;
            this.Num2 = num2;
}
        public void sum() {
            Console.WriteLine("这两个数相加和为{0}",(this.Num1+this.Num2));
        }
        public double Num3 { get; set; }
        public double Num4 { get; set; }

        public SumUtils(double num3, double num4)
        {
            this.Num3 = num3;
            this.Num4 = num4;
        }
        public void sum1()
        {
            Console.WriteLine("这两个数相加和为{0}", (this.Num3 + this.Num4));
        }

        private string character1;

        private string character2;
        //public string character1 { get; set; }
        //public string character2 { get; set; }

        public SumUtils(string Character1, string Character2)
        {
            this.character1 = Character1;
            this.character2 = Character2;
        }
        public void sum2()
        {
            Console.WriteLine("{0}", (this.character1 + this.character2));
        }

        public int k { get; set; }
     
        public SumUtils(int m) {
            this.k = m;
        }

        public void accumulation() {
            int sum = 1;
            for (int i = 2; i <= k; i++)
            {
                sum = sum + i;
            }
            Console.WriteLine("累加和的结果为{0}",sum);
        }
    }
}
